/**
 * 
 */
package model.admin;

import java.sql.ResultSet;
import java.util.ArrayList;

import myutil.Connect;

import vo.CollegeStaffVo;

/**
 * @author Sony
 *
 */
public class GetStaffListMo {
	ArrayList<CollegeStaffVo> list=new ArrayList<CollegeStaffVo>();
	public ArrayList<CollegeStaffVo> getStaffList() {
		Connect c=new Connect();
		String query="select * from college_staff";
		try {
			ResultSet rs=c.getResult(query);
			while(rs.next())
			{
				CollegeStaffVo vo=new CollegeStaffVo();
				vo.setAddress_line(rs.getString("address_line"));
				vo.setCity(rs.getString("city"));
				vo.setCountry(rs.getString("country"));
				vo.setDesignation(rs.getString("designation"));
				vo.setStaff_name(rs.getString("staff_name"));
				vo.setStaff_id(rs.getInt("staff_id"));
				vo.setAcc_no(rs.getInt("acc_no"));
				vo.setRoll_number(rs.getString("roll_number"));
				list.add(vo);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}
	public ArrayList<CollegeStaffVo> getStaffDetails(int staff_id) {
		
		Connect c=new Connect();
		String query="select * from college_staff where staff_id="+staff_id;
		System.out.println(query);
		try {
			ResultSet rs=c.getResult(query);
			while(rs.next())
			{
				CollegeStaffVo vo=new CollegeStaffVo();
				vo.setAddress_line(rs.getString("address_line"));
				vo.setCity(rs.getString("city"));
				vo.setCountry(rs.getString("country"));
				vo.setDesignation(rs.getString("designation"));
				vo.setStaff_name(rs.getString("staff_name"));
				vo.setStaff_id(rs.getInt("staff_id"));
				vo.setRoll_number(rs.getString("roll_number"));
				vo.setAcc_no(rs.getInt("acc_no"));
				list.add(vo);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}
}
